package pl.edu.pw.perg.compinfodb.dao;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Expression;

import pl.edu.pw.perg.compinfodb.entities.User;

public class UserDAO extends GenericSpringDAO<User> implements IUserDAO {

	
	public User findByLogin(String login) {
		return findUniqueByCriteria(Expression.eq("login", login));
	}

	@Override
	public void deleteAll() {
		Session s = getSession();
	    Query q = s.createQuery("delete from User"); 
	    q.executeUpdate();
	}

}
